# QtGui.QSplitter lets the user control the size of child widgets by dragging the boundary between the children.
# In our example, we show three QtGui.QFrame widgets organized with two splitters.
# On the PySide documentation page, all frame styles are given. Worth reviewing
# Also see for the available widget galleries here
# http://harmattan-dev.nokia.com/docs/library/html/qt4/gallery.html?tab=3&q=cleanlooks&sp=all

import sys
from PySide import QtGui, QtCore

class Example(QtGui.QWidget):

    def __init__(self):
        super(Example, self).__init__()

        hbox = QtGui.QHBoxLayout(self)

        # Create a frame object
        topLeft = QtGui.QFrame(self)
        # Set the frame shape to a StyledPanel. A StyledPanel draws a rectangular panel with a look that depends
        # on the current GUI style. Note that a styled panel has very subtle changes in appearance.
        # Options are NoFrame, Box, Panel, HLine, VLine, StyledPanel
        topLeft.setFrameShape(QtGui.QFrame.StyledPanel) # Style
        # We can also set shadow styles to frames. Other shadow style options are Plain and Sunken
        topLeft.setFrameShadow(QtGui.QFrame.Raised)

        # This one would look ugly
        topRight = QtGui.QFrame(self)
        topRight.setFrameStyle(QtGui.QFrame.Panel | QtGui.QFrame.Raised)
        topRight.setLineWidth(3)
        topRight.setMidLineWidth(2)


        bottom = QtGui.QFrame(self)
        bottom.setFrameShape(QtGui.QFrame.StyledPanel)

        # Create a splitter for horizontal division
        splitter1 = QtGui.QSplitter(QtCore.Qt.Horizontal)
        # Add the two desired widgets
        splitter1.addWidget(topLeft)
        splitter1.addWidget(topRight)

        # Create a splitter for vertical division
        splitter2 = QtGui.QSplitter(QtCore.Qt.Vertical)
        # Add the two desired widgets
        splitter2.addWidget(splitter1)
        splitter2.addWidget(bottom)

        # Since splitter 2 is holding splitter 1 now. We add splitter 2 to the hbox
        hbox.addWidget(splitter2)
        self.setLayout(hbox)
        # There are various 'Widget galleries' available. Typically they include “windows”, “motif”, “cde”, “plastique”
        # and “cleanlooks”. Depending on the platform, “windowsxp”, “windowsvista” and “macintosh” may be available.
        QtGui.QApplication.setStyle(QtGui.QStyleFactory.create('cleanlooks'))


        self.setGeometry(300, 300, 300, 200)
        self.setWindowTitle('QtGui.QSplitter')

if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)
    ex = Example()
    ex.show()
    sys.exit(app.exec_())

